Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alias Support #95

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Alias Support #95

wants to merge 5 commits into from

Conversation

msroot
Copy link

@msroot msroot commented Jan 27, 2021

String Alias support methods.
I am using Graphql and it supports only string keys in objects inputs so i am using an alias

example: equal == ==

var alias = {
	equal: "==",
	strictEqual: "===",
	notEqual: "!=",
	strictNotEqual: "!==",
	greater: ">",
	greaterOrEqual: ">=",
	less: "<",
	lessOrEqual: "<=",
	booleanCasting: "!!",
	not: "!",
	modulo: "%",
	add: "+",
	multiply: "*",
	substract: "-",
	divide: "/",
}


//Specs:		

[ {"equal":[1,1]}, {}, true ],
[ {"strictEqual":[1,1]}, {}, true ],
[ {"notEqual":[1,2]}, {}, true ],
[ {"strictNotEqual":[1,2]}, {}, true ],
[ {"greater":[2,1]}, {}, true ],
[ {"greaterOrEqual":[2,1]}, {}, true ],
[ {"less":[2,1]}, {}, false ],
[ {"lessOrEqual":[2,1]}, {}, false ],
[ {"booleanCasting" : [ "0" ]}, {}, true],
[ {"not":[false]}, {}, true ],   
[ {"modulo":[1,2]}, {}, 1 ],
[ {"add":[1,1]}, {}, 2 ],
[ {"multiply":[3,2]}, {}, 6 ],
[ {"substract":[2,3]}, {}, -1 ],   
[ {"divide":[1,1]}, {}, 1 ],

Also there is a fix for specs; https://jsonlogic.com/tests.json redirect to htttps

@josephdpurcell
Copy link

I like the idea of compatibility / support for GraphQL.

An alternative approach might be to put this as a different package? The idea would be to have some new package called something like json-logic-js-graphql, and all that lib does is do add_operation for all the aliases?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants